<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../../print.css" type="text/css" media="print">
<meta content="Signal,idv.cjcat.signals.Signal,listeners,valueClasses,add,addOnce,clear,dispatch,getPriority,remove" name="keywords">
<title>idv.cjcat.signals.Signal</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'Signal - API Documentation';
				var baseRef = '../../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">CJSignals v1.0</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../all-classes.html')" href="../../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../all-classes.html')" href="../../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../index-list.html')" href="../../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../../index.html?idv/cjcat/signals/Signal.html&amp;idv/cjcat/signals/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;Signal</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class Signal"); titleBar_setSubNav(false,true,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">idv.cjcat.signals</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class Signal</td>
</tr>
<tr>
<td class="classHeaderTableLabel">Implements</td><td><a href="ISignal.html">ISignal</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Subclasses</td><td><a href="../signals/NativeSignal.html">NativeSignal</a></td>
</tr>
</table>
<p></p>
  This class serves as the Subject in the Observer Pattern. 
  Listeners function listening to a signal are Observers. 
  One signal should correspond to one type of event. 
  A signal adds event-dispatching functionality thorugh composition rather than 
  inheriting the <code>EventDispatcher</code> class.
  <p/>
  A class with signals should expose getters to its signal objects, 
  allowing external listeners to listen to the signals.
  <p></p>
<br>
<hr>
</div>
<a name="propertySummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Properties</div>
<table id="summaryTableProperty" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#listeners">listeners</a> : Array<div class="summaryTableDescription">[read-only]
   
   A copy of the array of listeners listening to this signal.</div>
</td><td class="summaryTableOwnerCol">Signal</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#valueClasses">valueClasses</a> : Array<div class="summaryTableDescription">[read-only]
   
   A copy of the array of the signal's value classes.</div>
</td><td class="summaryTableOwnerCol">Signal</td>
</tr>
</table>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#Signal()">Signal</a>(... valueClasses)</div>
<div class="summaryTableDescription">
   Creates a signal to dispatch value objects.</div>
</td><td class="summaryTableOwnerCol">Signal</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#add()">add</a>(listener:Function, priority:int = 0):Function</div>
<div class="summaryTableDescription">
   
   Adds a listener to the signal.</div>
</td><td class="summaryTableOwnerCol">Signal</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#addOnce()">addOnce</a>(listener:Function, priority:int = 0):Function</div>
<div class="summaryTableDescription">
   
   Same as the <code>addListner()</code> method, only that the listener is removed
   right after it is invoked when value objects are dispatched.</div>
</td><td class="summaryTableOwnerCol">Signal</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#clear()">clear</a>():void</div>
<div class="summaryTableDescription">
   
   Removes all listeners.</div>
</td><td class="summaryTableOwnerCol">Signal</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#dispatch()">dispatch</a>(... valueObjects):<a href="../signals/Signal.html">Signal</a>
</div>
<div class="summaryTableDescription">
   
   Dispatches value objects.</div>
</td><td class="summaryTableOwnerCol">Signal</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getPriority()">getPriority</a>(listener:Function):Number</div>
<div class="summaryTableDescription">
   
   </div>
</td><td class="summaryTableOwnerCol">Signal</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#remove()">remove</a>(listener:Function):Function</div>
<div class="summaryTableDescription">
   
   Removes a listener function from the signal.</div>
</td><td class="summaryTableOwnerCol">Signal</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="propertyDetail"></a>
<div class="detailSectionHeader">Property detail</div>
<a name="listeners"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">listeners</td><td class="detailHeaderType">property</td>
</tr>
</table>
<div class="detailBody">
<code>listeners:Array</code>&nbsp;&nbsp;[read-only]<p>
   
   A copy of the array of listeners listening to this signal.
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get listeners():Array</code>
<br>
</div>
<a name="valueClasses"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">valueClasses</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>valueClasses:Array</code>&nbsp;&nbsp;[read-only]<p>
   
   A copy of the array of the signal's value classes.
   </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get valueClasses():Array</code>
<br>
</div>
<a name="constructorDetail"></a>
<div class="detailSectionHeader">Constructor detail</div>
<a name="Signal()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">Signal</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">constructor</td>
</tr>
</table>
<div class="detailBody">
<code>public function Signal(... valueClasses)</code><p>
   Creates a signal to dispatch value objects.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code>... <span class="label">valueClasses</span></code> &mdash; An array of <code>Class</code> object references 
   for value object type-checking upon the invocation of the 
   <code>dispatch()</code> method.
   <p/>
   For instance, <code>new Signal(int, String)</code> allows
   <p/>
   <code>dispatch(123, "abc")</code>
   <p/>
   but not
   <p/>
   <code>dispatch("abc", 123)</code>
   <p/>
   nor
   <p/>
   <code>dispatch(123, "abc", true)</code>
   <p/>
   nor
   <p/>
   <code>dispatch()</code>
   </td>
</tr>
</table>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="add()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">add</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public final function add(listener:Function, priority:int = 0):Function</code><p>
   
   Adds a listener to the signal. 
   Re-adding a listener that is already added to the signal overwrites its priority. 
   If a listener was added to the signal through the <code>addOnce()</code> method 
   and is not removed yet, the "onceness" is removed.
   <p/>
   You may add listeners within a listener during a dispatch, but it will only 
   take effect after the dispatch is finished.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">listener</span>:Function</code> &mdash; The listener function, whose parameter types shall match 
   the signal's <code>valueClasses</code> array.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">priority</span>:int</code> (default = <code>0</code>)<code></code> &mdash; The priority of the listener function. Listeners with
   higher priority are invoked first when value objects are dispatched. 
   When two listeners have equal priority, whichever is added first is invoked first.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Function</code> &mdash; The listener function.
   </td>
</tr>
</table>
</div>
<a name="addOnce()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">addOnce</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public final function addOnce(listener:Function, priority:int = 0):Function</code><p>
   
   Same as the <code>addListner()</code> method, only that the listener is removed
   right after it is invoked when value objects are dispatched. 
   Re-adding a listener that is already added to the signal overwrites its priority. 
   If a listener was added to the signal through the <code>addOnce()</code> method 
   and is not removed yet, the "onceness" is added.
   <p/>
   You may add listeners within a listener during a dispatch, but it will only 
   take effect after the dispatch is finished.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">listener</span>:Function</code> &mdash; The listener function, whose parameter types shall match 
   the signal's <code>valueClasses</code> array.
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">priority</span>:int</code> (default = <code>0</code>)<code></code> &mdash; The priority of the listener function. Listeners with
   higher priority are invoked first when value objects are dispatched. 
   When two listeners have equal priority, whichever is added first is invoked first.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Function</code> &mdash; The listener function.
   </td>
</tr>
</table>
</div>
<a name="clear()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">clear</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public final function clear():void</code><p>
   
   Removes all listeners.
   <p/>
   You clear all listeners within a listener during a dispatch, but it will only 
   take effect after the dispatch is finished.
   </p></div>
<a name="dispatch()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">dispatch</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public final function dispatch(... valueObjects):<a href="../signals/Signal.html">Signal</a></code><p>
   
   Dispatches value objects. Listener functions added to the signal are invoked 
   with value objects passed as arguments.
   <p/>
   You may add or remove listeners within a listener during a dispatch, but it will only 
   take effect after the dispatch is finished.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code>... <span class="label">valueObjects</span></code> &mdash; The value objects dispatched.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../signals/Signal.html">Signal</a></code> &mdash; 
                        The signal.
   
                        
                     </td>
</tr>
</table>
</div>
<a name="getPriority()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getPriority</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function getPriority(listener:Function):Number</code><p>
   
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">listener</span>:Function</code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Number</code> &mdash; The prioirty of the listener function.
   </td>
</tr>
</table>
</div>
<a name="remove()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">remove</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public final function remove(listener:Function):Function</code><p>
   
   Removes a listener function from the signal.
   <p/>
   You may remove listeners within a listener during a dispatch, but it will only 
   take effect after the dispatch is finished.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">listener</span>:Function</code> &mdash; The listener function.
   </td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Function</code> &mdash; The listener function.
   </td>
</tr>
</table>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
